Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(busted) - before_each and after_each execute in unpredictable order - fixes #491 #508

Merged

Conversation

stringTrimmer
Copy link
Contributor

@stringTrimmer stringTrimmer commented Jul 9, 2023

Fixes #491 ; Encountered the same problem as @OscarCreator.
Just changed the tables that store the before_each and after_each functions to be indexed by the parent describes index in the current_describe table which uses sequential integers. Then in the run_each function where these functions get executed, iterating thru them usning ipairs instead of pairs. That seems to put things in the order I'd expect.

Of course if you run the tests using the old code, they might be successful occasionally (it's up to however lua decides to store/iterate the table keys each time). But using the changes, the tests should succeed every time.

…table

order. Just changed the tables that store these functions to be indexed by the
parent `describe`s index in the current_describe table which uses
sequential integers.  Then in the run_each function where these
functions get executed, iterating thru them usning ipairs instead of
pairs.
@stringTrimmer stringTrimmer changed the title fix(busted) #491 - before_each and after_each execute in unpredictable order fix(busted) - before_each and after_each execute in unpredictable order - fixes #491 Jul 17, 2023
@OscarCreator
Copy link

Great! Could we get this merged soon?

@Conni2461
Copy link
Collaborator

thanks :)

@Conni2461 Conni2461 merged commit dd5a2f6 into nvim-lua:master Aug 24, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] nested before_each and after_each execute in random order
3 participants